package com.qf.myexception;

import com.qf.utils.ResultMsg;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@ResponseBody
public class ControllerExceptionHandler {
    /**
     * 异常处理器
     * @param e
     * @return
     */
    @ExceptionHandler(Exception.class)
    public ResultMsg handleException1(Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        return ResultMsg.FAILED(201,e.getMessage());
    }
}
